package com.lcxw.hxzbapi.service;

import com.lcxw.hxzbapi.dao.mapper.TicketMapper;
import com.lcxw.hxzbapi.entity.pojo.Ticket;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class TicketService {

    @Resource
    TicketMapper ticketMapper;

    //插入一个用户的抽奖券
    public int insert(Ticket ticket) {
        return ticketMapper.insert(ticket);
    }

    //通过用户的userId查询抽奖券
    public Ticket selectByUserId(Long userId) {
        return ticketMapper.selectByUserId(userId);
    }

    //通过userId更新用户的抽奖券
    public int updateTicket(Ticket ticket) {
        return ticketMapper.updateTicket(ticket);
    }

    public int updateLuckyByUserId(Long userId, int lucky) {
        return ticketMapper.updateLuckyByUserId(userId, lucky);
    }

    public int updateDiamondByUserId(Long userId, int diamond) {
        return ticketMapper.updateDiamondByUserId(userId, diamond);
    }
}
